<?php $this->_extends('_layouts/main_layout'); ?>
<?php $this->_block('title'); ?>
	Site Performance
<?php $this->_endblock(); ?>

<?php $this->_block('contents'); ?>
		<div id="content" class="box">
			<h1>Site Performance</h1>
			<form method="get" action="<?php echo url('report/site'); ?>">
				<div class="filter">
					<select id="duration" name="duration">
						<option value="0" <?php echo (isset($duration) && $duration=="0") ? 'selected="selected"' : '';?>>Today</option>
						<option value="1" <?php echo (isset($duration) && $duration=="1") ? 'selected="selected"' : '';?>>Yesterday</option>
						<option value="2" <?php echo (isset($duration) && $duration=="2") ? 'selected="selected"' : '';?>>Last 7 days</option>
						<option value="3" <?php echo (isset($duration) && $duration=="3") ? 'selected="selected"' : '';?>>Month to Date</option>
						<option value="4" <?php echo (isset($duration) && $duration=="4") ? 'selected="selected"' : '';?>>Last Month</option>
						<option value="5" <?php echo (isset($duration) && $duration=="5") ? 'selected="selected"' : '';?>>Lifetime</option>
					</select>
					<?php
						 echo Util::buildDropDownList(
						 	array('id'=>'site', 'name'=>'site'),
						 	$sites,
						 	isset($site) ? $site: false,
						 	array('k'=>'', 'l'=>'--All--')
						 );
					?>
					<input type="submit" value="Get Report" />
				</div>
			</form>
			
			<table class="full-size">
				<thead>
					<tr>
						<th>Start Date</th>
						<th>End Date</th>
						<th>Destination URL</th>
						<th>Publisher</th>
						<th>Impression</th>
						<th>Short Leads</th>
						<th>Long Leads</th>
						<th>User Play</th>
						<th>User Clicks</th>
						<th>User Total Conversions</th>
						<!--  
						<th>User Pending Conversions</th>
						<th>User Declined Conversions</th>
						<th>User Completed Conversions</th>
						<th>LP - Short</th>
						
						<th>Short - Long</th>
						<th>LP - Long</th>
						<th>Play per Short Lead</th>
						<th>Clicks per Short Lead</th>
						<th>Conversions per Short Lead</th>
						-->
					</tr>
				</thead>
				<tbody>
					<?php 
						if(!empty($reportItems)):						
							$durations = Util::getReportDuration($duration);
						    foreach ($reportItems as $reportItem):
					?>
							<tr>
								<td><?php echo $durations[0];?></td>
								<td><?php echo $durations[1];?></td>
								<td><?php echo $reportItem['lu'];?></td>
								<td><?php echo $reportItem['pub'];?></td>
								<td><?php echo $reportItem['impression'];?></td>
								<td><?php echo $reportItem['short_leads'];?></td>
								<td><?php echo $reportItem['long_leads'];?></td>
								<td><?php echo $reportItem['play'];?></td>
								<td><?php echo $reportItem['click'];?></td>
								<td><?php echo $reportItem['conversion'];?></td>
								<!-- 
								<td><?php echo $reportItem['leads'];?></td>
								<td><?php echo $reportItem['conversion'];?></td>
								<td><?php echo $reportItem['revenue'];?></td>
								<td><?php echo $reportItem['cost'];?></td>
								 -->
							</tr>
						<?php endforeach;?>
					<?php endif;?>
				</tbody>
			</table>
			
		</div>
<?php $this->_endblock(); ?>